trainFile = open('RateValing.txt', 'rb')
trainRealFile = open('RateValingReal.txt', 'ab')

index = []
indexNumber = -1

for oneline in trainFile.readlines():
    oneline = oneline[2:]
    onelineIndex = oneline.split('/', 1)[0]
    twolineIndex = oneline.split('/', 1)[1]
    if onelineIndex not in index:
        index.append(onelineIndex)
        indexNumber = indexNumber + 1
    realOut = twolineIndex.strip() + ' ' + str(indexNumber) + '\n'
    print realOut
    trainRealFile.write(realOut)
